package exercise;
class Stu{
    private int id;
    private String name;
}
public class Test01 {
    //反射常用的三种方式
    public static void main(String[] args) throws NoSuchFieldException, ClassNotFoundException {
        //通过建立对象
        Stu stu = new Stu();
        Class classpoj = stu.getClass();
        System.out.println(classpoj.getName());
        //通过相对路径
        Class classpoj2 = Class.forName("exercise.Stu");
        System.out.println(classpoj2.getName());
        //通过类名
        Class classoj3 = Stu.class;
        System.out.println(classoj3.getName());
    }
}
